/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package TapestryModel.impl;

import TapestryModel.Page;
import TapestryModel.Site;
import TapestryModel.TapestryModelPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Site</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link TapestryModel.impl.SiteImpl#getAuthor <em>Author</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getUrl <em>Url</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getTitle <em>Title</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getName <em>Name</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getArtifactId <em>Artifact Id</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getGroupId <em>Group Id</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getBasePackage <em>Base Package</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getVersion <em>Version</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getTapestryVersion <em>Tapestry Version</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getPage <em>Page</em>}</li>
 *   <li>{@link TapestryModel.impl.SiteImpl#getObject <em>Object</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SiteImpl extends EObjectImpl implements Site {
    /**
     * The default value of the '{@link #getAuthor() <em>Author</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getAuthor()
     * @generated
     * @ordered
     */
    protected static final String AUTHOR_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getAuthor() <em>Author</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getAuthor()
     * @generated
     * @ordered
     */
    protected String author = AUTHOR_EDEFAULT;

    /**
     * The default value of the '{@link #getUrl() <em>Url</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getUrl()
     * @generated
     * @ordered
     */
    protected static final String URL_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getUrl() <em>Url</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getUrl()
     * @generated
     * @ordered
     */
    protected String url = URL_EDEFAULT;

    /**
     * The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getTitle()
     * @generated
     * @ordered
     */
    protected static final String TITLE_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getTitle()
     * @generated
     * @ordered
     */
    protected String title = TITLE_EDEFAULT;

    /**
     * The default value of the '{@link #getName() <em>Name</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getName()
     * @generated
     * @ordered
     */
    protected static final String NAME_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getName()
     * @generated
     * @ordered
     */
    protected String name = NAME_EDEFAULT;

    /**
     * The default value of the '{@link #getArtifactId() <em>Artifact Id</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getArtifactId()
     * @generated
     * @ordered
     */
    protected static final String ARTIFACT_ID_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getArtifactId() <em>Artifact Id</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getArtifactId()
     * @generated
     * @ordered
     */
    protected String artifactId = ARTIFACT_ID_EDEFAULT;

    /**
     * The default value of the '{@link #getGroupId() <em>Group Id</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getGroupId()
     * @generated
     * @ordered
     */
    protected static final String GROUP_ID_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getGroupId() <em>Group Id</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getGroupId()
     * @generated
     * @ordered
     */
    protected String groupId = GROUP_ID_EDEFAULT;

    /**
     * The default value of the '{@link #getBasePackage() <em>Base Package</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getBasePackage()
     * @generated
     * @ordered
     */
    protected static final String BASE_PACKAGE_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getBasePackage() <em>Base Package</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getBasePackage()
     * @generated
     * @ordered
     */
    protected String basePackage = BASE_PACKAGE_EDEFAULT;

    /**
     * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getDescription()
     * @generated
     * @ordered
     */
    protected static final String DESCRIPTION_EDEFAULT = "tapetry project";

    /**
     * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getDescription()
     * @generated
     * @ordered
     */
    protected String description = DESCRIPTION_EDEFAULT;

    /**
     * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getVersion()
     * @generated
     * @ordered
     */
    protected static final String VERSION_EDEFAULT = "1.0.0-SNAPSHOT";

    /**
     * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getVersion()
     * @generated
     * @ordered
     */
    protected String version = VERSION_EDEFAULT;

    /**
     * The default value of the '{@link #getTapestryVersion() <em>Tapestry Version</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getTapestryVersion()
     * @generated
     * @ordered
     */
    protected static final String TAPESTRY_VERSION_EDEFAULT = "5.0.18";

    /**
     * The cached value of the '{@link #getTapestryVersion() <em>Tapestry Version</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getTapestryVersion()
     * @generated
     * @ordered
     */
    protected String tapestryVersion = TAPESTRY_VERSION_EDEFAULT;

    /**
     * The cached value of the '{@link #getPage() <em>Page</em>}' containment reference list.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPage()
     * @generated
     * @ordered
     */
    protected EList<Page> page;

    /**
     * The cached value of the '{@link #getObject() <em>Object</em>}' containment reference list.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getObject()
     * @generated
     * @ordered
     */
    protected EList<TapestryModel.Object> object;

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected SiteImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    protected EClass eStaticClass() {
        return TapestryModelPackage.Literals.SITE;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getAuthor() {
        return author;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setAuthor(String newAuthor) {
        String oldAuthor = author;
        author = newAuthor;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__AUTHOR, oldAuthor, author));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getUrl() {
        return url;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setUrl(String newUrl) {
        String oldUrl = url;
        url = newUrl;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__URL, oldUrl, url));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getTitle() {
        return title;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setTitle(String newTitle) {
        String oldTitle = title;
        title = newTitle;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__TITLE, oldTitle, title));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getName() {
        return name;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setName(String newName) {
        String oldName = name;
        name = newName;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__NAME, oldName, name));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getArtifactId() {
        return artifactId;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setArtifactId(String newArtifactId) {
        String oldArtifactId = artifactId;
        artifactId = newArtifactId;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__ARTIFACT_ID, oldArtifactId, artifactId));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getGroupId() {
        return groupId;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setGroupId(String newGroupId) {
        String oldGroupId = groupId;
        groupId = newGroupId;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__GROUP_ID, oldGroupId, groupId));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getBasePackage() {
        return basePackage;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setBasePackage(String newBasePackage) {
        String oldBasePackage = basePackage;
        basePackage = newBasePackage;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__BASE_PACKAGE, oldBasePackage, basePackage));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getDescription() {
        return description;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setDescription(String newDescription) {
        String oldDescription = description;
        description = newDescription;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__DESCRIPTION, oldDescription, description));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getVersion() {
        return version;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setVersion(String newVersion) {
        String oldVersion = version;
        version = newVersion;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__VERSION, oldVersion, version));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getTapestryVersion() {
        return tapestryVersion;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setTapestryVersion(String newTapestryVersion) {
        String oldTapestryVersion = tapestryVersion;
        tapestryVersion = newTapestryVersion;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, TapestryModelPackage.SITE__TAPESTRY_VERSION, oldTapestryVersion, tapestryVersion));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public EList<Page> getPage() {
        if (page == null) {
            page = new EObjectContainmentWithInverseEList<Page>(Page.class, this, TapestryModelPackage.SITE__PAGE, TapestryModelPackage.PAGE__SITE);
        }
        return page;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public EList<TapestryModel.Object> getObject() {
        if (object == null) {
            object = new EObjectContainmentWithInverseEList<TapestryModel.Object>(TapestryModel.Object.class, this, TapestryModelPackage.SITE__OBJECT, TapestryModelPackage.OBJECT__SITE);
        }
        return object;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @SuppressWarnings("unchecked")
    @Override
    public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case TapestryModelPackage.SITE__PAGE:
                return ((InternalEList<InternalEObject>)(InternalEList<?>)getPage()).basicAdd(otherEnd, msgs);
            case TapestryModelPackage.SITE__OBJECT:
                return ((InternalEList<InternalEObject>)(InternalEList<?>)getObject()).basicAdd(otherEnd, msgs);
        }
        return super.eInverseAdd(otherEnd, featureID, msgs);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case TapestryModelPackage.SITE__PAGE:
                return ((InternalEList<?>)getPage()).basicRemove(otherEnd, msgs);
            case TapestryModelPackage.SITE__OBJECT:
                return ((InternalEList<?>)getObject()).basicRemove(otherEnd, msgs);
        }
        return super.eInverseRemove(otherEnd, featureID, msgs);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case TapestryModelPackage.SITE__AUTHOR:
                return getAuthor();
            case TapestryModelPackage.SITE__URL:
                return getUrl();
            case TapestryModelPackage.SITE__TITLE:
                return getTitle();
            case TapestryModelPackage.SITE__NAME:
                return getName();
            case TapestryModelPackage.SITE__ARTIFACT_ID:
                return getArtifactId();
            case TapestryModelPackage.SITE__GROUP_ID:
                return getGroupId();
            case TapestryModelPackage.SITE__BASE_PACKAGE:
                return getBasePackage();
            case TapestryModelPackage.SITE__DESCRIPTION:
                return getDescription();
            case TapestryModelPackage.SITE__VERSION:
                return getVersion();
            case TapestryModelPackage.SITE__TAPESTRY_VERSION:
                return getTapestryVersion();
            case TapestryModelPackage.SITE__PAGE:
                return getPage();
            case TapestryModelPackage.SITE__OBJECT:
                return getObject();
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @SuppressWarnings("unchecked")
    @Override
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case TapestryModelPackage.SITE__AUTHOR:
                setAuthor((String)newValue);
                return;
            case TapestryModelPackage.SITE__URL:
                setUrl((String)newValue);
                return;
            case TapestryModelPackage.SITE__TITLE:
                setTitle((String)newValue);
                return;
            case TapestryModelPackage.SITE__NAME:
                setName((String)newValue);
                return;
            case TapestryModelPackage.SITE__ARTIFACT_ID:
                setArtifactId((String)newValue);
                return;
            case TapestryModelPackage.SITE__GROUP_ID:
                setGroupId((String)newValue);
                return;
            case TapestryModelPackage.SITE__BASE_PACKAGE:
                setBasePackage((String)newValue);
                return;
            case TapestryModelPackage.SITE__DESCRIPTION:
                setDescription((String)newValue);
                return;
            case TapestryModelPackage.SITE__VERSION:
                setVersion((String)newValue);
                return;
            case TapestryModelPackage.SITE__TAPESTRY_VERSION:
                setTapestryVersion((String)newValue);
                return;
            case TapestryModelPackage.SITE__PAGE:
                getPage().clear();
                getPage().addAll((Collection<? extends Page>)newValue);
                return;
            case TapestryModelPackage.SITE__OBJECT:
                getObject().clear();
                getObject().addAll((Collection<? extends TapestryModel.Object>)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case TapestryModelPackage.SITE__AUTHOR:
                setAuthor(AUTHOR_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__URL:
                setUrl(URL_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__TITLE:
                setTitle(TITLE_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__NAME:
                setName(NAME_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__ARTIFACT_ID:
                setArtifactId(ARTIFACT_ID_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__GROUP_ID:
                setGroupId(GROUP_ID_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__BASE_PACKAGE:
                setBasePackage(BASE_PACKAGE_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__DESCRIPTION:
                setDescription(DESCRIPTION_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__VERSION:
                setVersion(VERSION_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__TAPESTRY_VERSION:
                setTapestryVersion(TAPESTRY_VERSION_EDEFAULT);
                return;
            case TapestryModelPackage.SITE__PAGE:
                getPage().clear();
                return;
            case TapestryModelPackage.SITE__OBJECT:
                getObject().clear();
                return;
        }
        super.eUnset(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case TapestryModelPackage.SITE__AUTHOR:
                return AUTHOR_EDEFAULT == null ? author != null : !AUTHOR_EDEFAULT.equals(author);
            case TapestryModelPackage.SITE__URL:
                return URL_EDEFAULT == null ? url != null : !URL_EDEFAULT.equals(url);
            case TapestryModelPackage.SITE__TITLE:
                return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
            case TapestryModelPackage.SITE__NAME:
                return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
            case TapestryModelPackage.SITE__ARTIFACT_ID:
                return ARTIFACT_ID_EDEFAULT == null ? artifactId != null : !ARTIFACT_ID_EDEFAULT.equals(artifactId);
            case TapestryModelPackage.SITE__GROUP_ID:
                return GROUP_ID_EDEFAULT == null ? groupId != null : !GROUP_ID_EDEFAULT.equals(groupId);
            case TapestryModelPackage.SITE__BASE_PACKAGE:
                return BASE_PACKAGE_EDEFAULT == null ? basePackage != null : !BASE_PACKAGE_EDEFAULT.equals(basePackage);
            case TapestryModelPackage.SITE__DESCRIPTION:
                return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
            case TapestryModelPackage.SITE__VERSION:
                return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
            case TapestryModelPackage.SITE__TAPESTRY_VERSION:
                return TAPESTRY_VERSION_EDEFAULT == null ? tapestryVersion != null : !TAPESTRY_VERSION_EDEFAULT.equals(tapestryVersion);
            case TapestryModelPackage.SITE__PAGE:
                return page != null && !page.isEmpty();
            case TapestryModelPackage.SITE__OBJECT:
                return object != null && !object.isEmpty();
        }
        return super.eIsSet(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public String toString() {
        if (eIsProxy()) return super.toString();

        StringBuffer result = new StringBuffer(super.toString());
        result.append(" (author: ");
        result.append(author);
        result.append(", url: ");
        result.append(url);
        result.append(", title: ");
        result.append(title);
        result.append(", name: ");
        result.append(name);
        result.append(", artifactId: ");
        result.append(artifactId);
        result.append(", groupId: ");
        result.append(groupId);
        result.append(", basePackage: ");
        result.append(basePackage);
        result.append(", description: ");
        result.append(description);
        result.append(", version: ");
        result.append(version);
        result.append(", tapestryVersion: ");
        result.append(tapestryVersion);
        result.append(')');
        return result.toString();
    }

} //SiteImpl
